package licode.unisop.starter.singleapp.handler;

import com.kaka.Startup;
import com.kaka.notice.Facade;
import com.kaka.notice.FacadeFactory;
import com.kaka.notice.Message;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.util.concurrent.Executors;

/**
 * @author WR
 * @since 2016/6/16 14:49
 */
@Component
public class SystemInit extends Startup implements ApplicationRunner  {

    @Override
    public void run(ApplicationArguments args) throws Exception {
        Facade facade = FacadeFactory.getFacade();
        this.scan("licode.unisop");
        // 全局仅设置一次
        facade.initThreadPool(Executors.newFixedThreadPool(2));

        facade.sendMessage(new Message("1000", "让MyCommand接收执行"));
    }
}
